<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<meta charset="utf-8" />
    <th:block th:include="include :: header('用户列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
	                            <li>
	                                <p>昵称：</p>
	                                <input type="text" name="nickname"/>
	                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
		var sexDatas = [[${@dict.getType('sys_user_sex')}]];	
        var prefix = ctx + "openapi";

        $(function() {
            var options = {
                url: prefix + "/user/list",
                updateUrl: prefix + "/editUser/{id}",
                modalName: "用户详情",
// 				pageSize:5,
//              showSearch: false,
// 		        showRefresh: false,
		        showToggle: false,
		        showColumns: false,
                columns: [
                {
                	field:'num',
                	title:'序号',
                    formatter: function(value, row, index) {
                        //获取每页显示的数量
                        var pageSize=$('#bootstrap-table').bootstrapTable('getOptions').pageSize;
                        //获取当前是第几页
                        var pageNumber=$('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
                        //返回序号，注意index是从0开始的，所以要加上1
                        return pageSize * (pageNumber - 1) + index + 1;
                    },                		
                },	
                {
                    field : 'openid', 
                    title : 'openid',
                    visible:false
                },
                {
                    field : 'nickname', 
                    title : '昵称'
                },
                {
                    field : 'headimgurl', 
                    title : '头像',
                    visible: false
                },
                {
                    field : 'province', 
                    title : '省',
                },
                {
                    field : 'city', 
                    title : '市',
                },
                {
                    field : 'country', 
                    title : '国家',
                },
                {
                    field : 'sex', 
                    title : '性别',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(sexDatas, value);
                    },
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.detailFull(\'' + row.openid + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>